package xin.i18n.util;

import java.util.Locale;

public enum LocaleType {
	
	ZH("zh", Locale.CHINA),
	EN("en", Locale.US),
	ZH_CN("zh_CN", Locale.CHINA),
	SIMPLIFIED_CHINESE("zh_HK", Locale.SIMPLIFIED_CHINESE),
	TRADITIONAL_CHINESE("zh_TW", Locale.TRADITIONAL_CHINESE),
	EN_US("en_US", Locale.US),
	EN_GB("en_US", Locale.UK),
	EN_CA("en_US", Locale.CANADA);
	
	private Locale value;
	private String key;
	
	LocaleType(String key, Locale value) {
		this.key = key;
		this.value = value;
	}
	
	public static Locale getValue(String key) {
		for (LocaleType c : LocaleType.values()) {
			if (c.getKey().equals(key)) {
				return c.getValue();
			}
		}
		return null;
	}
	
	public Locale getValue() {
		return value;
	}
	
	public void setValue(Locale value) {
		this.value = value;
	}
	
	public String getKey() {
		return key;
	}
	
	public void setKey(String key) {
		this.key = key;
	}
}
